<?php
include('common.php');

if(isset($_GET['project'])){
	$project = $_GET['project'];
}else{
	$project = '';
}
if(!isset($_GET['module'])) error(500, 'require module param');

$module = str_replace('.', '/', $_GET['module']);

$baseDir = dirname(dirname(dirname(__FILE__)));
$file = "$baseDir/projects/$project/src/$module.js";
if(empty($project) || !file_exists($file)){
	$file = "$baseDir/src/$module.js";
	if(!file_exists($file)){
		error(404, $file);
	}
}
echo ok(file_get_contents($file));

